<!DOCTYPE html>
<html lang="en">

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
	
	<!-- title -->
	
	<title>
	
		12-centos命令2021之基础环境配置 | 
	 
	星河
	</title>
	
	<!-- keywords,description -->
	 

	<!-- favicon -->
	
	<link rel="shortcut icon" href="/xinghe/favicon.ico">
	


	<!-- search -->
	<script>
		var searchEngine = "https://www.google.com/search?q=";
		if(typeof searchEngine == "undefined" || searchEngine == null || searchEngine == ""){
			searchEngine = "https://www.google.com/search?q=";
		}
		var homeHost = "wujun234.github.io";
		if(typeof homeHost == "undefined" || homeHost == null || homeHost == ""){
			homeHost = window.location.host;
		}
	</script>


	
<link rel="stylesheet" href="/xinghe/css/main.css">

	
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">

	
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.17.1/build/styles/darcula.min.css">

	
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">


	
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>

	
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>

	
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.17.1/build/highlight.min.js"></script>

	
<script src="https://cdn.jsdelivr.net/npm/jquery-pjax@2.0.1/jquery.pjax.min.js"></script>

	
<script src="/xinghe/js/main.js"></script>

	
		
<script src="https://cdn.jsdelivr.net/npm/leancloud-storage/dist/av-min.js"></script>

		
<script src="https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js"></script>

	
	
		<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	
<meta name="generator" content="Hexo 5.4.0"></head>

<body>
	<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3efe99c287df5a1d6f0d02d187e403c1";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

<header id="header">
    <a id="title" href="/xinghe/" class="logo">星河</a>

	<ul id="menu">
		
	

	

		<li class="menu-item">
			<a href="https://blog.csdn.net/springyh" class="menu-item-link" target="_blank">
				myblog
			</a>
		</li>
		<li class="menu-item">
			<a href="https://www.yuque.com/yinhehe" class="menu-item-link" target="_blank">
				语雀
			</a>
		</li>
		<li class="menu-item">
			<a href="https://gitee.com/godyh" class="menu-item-link" target="_blank">
				<i class="fa fa-github fa-2x"></i>
			</a>
		</li>
	</ul>
</header>

	
<div id="sidebar">
	<button id="sidebar-toggle" class="toggle" ><i class="fa fa-arrow-right " aria-hidden="true"></i></button>
	
	<div id="site-toc">
		<input id="search-input" class="search-input" type="search" placeholder="按回车全站搜索">
		<div id="tree">
			

			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										01.面试系列
									</a>
									
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										01.java基础
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/01.java%E5%9F%BA%E7%A1%80/01-%E6%B3%A8%E8%A7%A3/">
										01-注解
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/01.java%E5%9F%BA%E7%A1%80/02-%E6%B3%9B%E5%9E%8B/">
										02-泛型
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/01.java%E5%9F%BA%E7%A1%80/03-JavaNIO/">
										03-JavaNIO
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/01.java%E5%9F%BA%E7%A1%80/04-%E5%8F%8D%E5%B0%84%E5%92%8C%E5%8A%A8%E6%80%81%E4%BB%A3%E7%90%86/">
										04-反射和动态代理
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										02.java并发
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/01-%E5%A4%9A%E7%BA%BF%E7%A8%8B%E5%9F%BA%E7%A1%80/">
										01-多线程基础
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/02-CAS/">
										02-CAS
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/03-synchronized/">
										03-synchronized
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/04-AQS%E5%92%8CReentrantLock/">
										04-AQS和ReentrantLock
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/05-%E7%BA%BF%E7%A8%8B%E6%B1%A0/">
										05-线程池
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/06-ThreadLocal/">
										06-ThreadLocal
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/07-CountDownLatch%E5%92%8CCyclicBarrier/">
										07-CountDownLatch和CyclicBarrier
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/08-%E4%B8%BA%E4%BB%80%E4%B9%88%E9%9C%80%E8%A6%81Java%E5%86%85%E5%AD%98%E6%A8%A1%E5%9E%8B/">
										08-为什么需要Java内存模型
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/02.java%E5%B9%B6%E5%8F%91/09-%E6%B7%B1%E5%85%A5%E6%B5%85%E5%87%BAJava%E5%86%85%E5%AD%98%E6%A8%A1%E5%9E%8B/">
										09-深入浅出Java内存模型
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										03.java容器
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/03.java%E5%AE%B9%E5%99%A8/01-List%E9%9B%86%E5%90%88/">
										01-List集合
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/03.java%E5%AE%B9%E5%99%A8/02-Map%E9%9B%86%E5%90%88/">
										02-Map集合
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/03.java%E5%AE%B9%E5%99%A8/03-Set%E9%9B%86%E5%90%88/">
										03-Set集合
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										04.java虚拟机
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/04.java%E8%99%9A%E6%8B%9F%E6%9C%BA/01-java%E7%BC%96%E8%AF%91%E5%88%B0%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B/">
										01-java编译到执行过程
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/04.java%E8%99%9A%E6%8B%9F%E6%9C%BA/02-%E5%8F%8C%E4%BA%B2%E5%A7%94%E6%B4%BE%E6%9C%BA%E5%88%B6/">
										02-双亲委派机制
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/04.java%E8%99%9A%E6%8B%9F%E6%9C%BA/03-JVM%E5%86%85%E5%AD%98%E7%BB%93%E6%9E%84/">
										03-JVM内存结构
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/04.java%E8%99%9A%E6%8B%9F%E6%9C%BA/04-%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E6%9C%BA%E5%88%B6/">
										04-垃圾回收机制
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/04.java%E8%99%9A%E6%8B%9F%E6%9C%BA/05-CMS%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E6%9C%BA%E5%88%B6/">
										05-CMS垃圾回收机制
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/04.java%E8%99%9A%E6%8B%9F%E6%9C%BA/06-G1%E5%9E%83%E5%9C%BE%E6%94%B6%E9%9B%86%E5%99%A8/">
										06-G1垃圾收集器
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										05.spring
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/05.spring/01-springMVC/">
										01-springMVC
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/05.spring/02-spring%E5%9F%BA%E7%A1%80/">
										02-spring基础
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/05.spring/03-springbean%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/">
										03-springbean生命周期
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										06.redis
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/06.redis/01-redis%E5%9F%BA%E7%A1%80/">
										01-redis基础
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/06.redis/02-redis%E6%8C%81%E4%B9%85%E5%8C%96/">
										02-redis持久化
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/06.redis/03-redis%E4%B8%BB%E4%BB%8E%E6%9E%B6%E6%9E%84/">
										03-redis主从架构
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/06.redis/04-redis%E5%88%86%E7%89%87%E9%9B%86%E7%BE%A4/">
										04-redis分片集群
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										07.消息队列
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/07.%E6%B6%88%E6%81%AF%E9%98%9F%E5%88%97/01-kafka%E5%9F%BA%E7%A1%80/">
										01-kafka基础
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/07.%E6%B6%88%E6%81%AF%E9%98%9F%E5%88%97/02-kafka%E8%80%83%E8%99%91%E7%9A%84%E9%97%AE%E9%A2%98/">
										02-kafka考虑的问题
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										08.mysql
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/08.mysql/01-mysql%E7%B4%A2%E5%BC%95/">
										01-mysql索引
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/08.mysql/02-mysql%E4%BA%8B%E5%8A%A1%E5%92%8C%E9%94%81%E6%9C%BA%E5%88%B6%E5%92%8CMVCC/">
										02-mysql事务和锁机制和MVCC
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/08.mysql/03-mysql%E8%B0%83%E4%BC%98/">
										03-mysql调优
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										09.场景
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/09.%E5%9C%BA%E6%99%AF/01-%E5%A6%82%E4%BD%95%E5%AE%9E%E7%8E%B0%E5%8E%BB%E9%87%8D%E5%92%8C%E5%B9%82%E7%AD%89/">
										01-如何实现去重和幂等
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/09.%E5%9C%BA%E6%99%AF/02-%E7%B3%BB%E7%BB%9F%E9%9C%80%E6%B1%82%E5%8F%98%E5%8C%96%E8%AE%BE%E8%AE%A1/">
										02-系统需求变化设计
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/01.%E9%9D%A2%E8%AF%95%E7%B3%BB%E5%88%97/09.%E5%9C%BA%E6%99%AF/03-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/">
										03-设计模式
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										02.常用工具类
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/01-CommonUtil/">
										01-CommonUtil
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/02-CookieUtils/">
										02-CookieUtils
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/03-DateUtils/">
										03-DateUtils
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/04-easyUIDataGrid%E5%AF%B9%E8%B1%A1%E8%BF%94%E5%9B%9E%E5%80%BC/">
										04-easyUIDataGrid对象返回值
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/05-Excel%E9%98%BF%E9%87%8C%E5%B7%B4%E5%B7%B4%E5%B7%A5%E5%85%B7/">
										05-Excel阿里巴巴工具
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/06-Excel%E5%AF%BC%E5%87%BA%E5%B7%A5%E5%85%B7/">
										06-Excel导出工具
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/07-ExceptionUtil/">
										07-ExceptionUtil
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/08-FastDFSClient%E4%BD%BF%E7%94%A8/">
										08-FastDFSClient使用
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/09-FTP%E4%B8%8A%E4%BC%A0%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8/">
										09-FTP上传工具使用
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/11-HttpClientUtil/">
										11-HttpClientUtil
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/12-HttpContextUtils/">
										12-HttpContextUtils
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/13-IDUtils/">
										13-IDUtils
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/14-IPUtils/">
										14-IPUtils
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/15-isBlack%E5%92%8CisEmpty%E5%8C%BA%E5%88%AB/">
										15-isBlack和isEmpty区别
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/16-jedisclient%E6%93%8D%E4%BD%9CRedis%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										16-jedisclient操作Redis工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/17-json%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										17-json工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/18-md5%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										18-md5工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/19-PictureResult/">
										19-PictureResult
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/20-PPTtoImage%E5%AE%9E%E7%8E%B0PPT%E8%BD%AC%E5%8C%96%E4%B8%BAPDF/">
										20-PPTtoImage实现PPT转化为PDF
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/21-ShiroUtils/">
										21-ShiroUtils
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/22-shiro%E7%9A%84md5%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										22-shiro的md5工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/23-spring%E5%AE%B9%E5%99%A8MD5%E5%B7%A5%E5%85%B7/">
										23-spring容器MD5工具
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/24-spring%E4%B8%AD%E8%87%AA%E5%B8%A6%E7%9A%84%E5%8A%A0%E5%AF%86%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										24-spring中自带的加密工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/25-TaotaoResult/">
										25-TaotaoResult
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/26-TimeUtls/">
										26-TimeUtls
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/27-%E4%BB%8E%E7%BD%91%E7%BB%9C%E4%B8%8A%E8%8E%B7%E5%8F%96%E5%9B%BE%E7%89%87%E8%BD%AC%E6%8D%A2%E6%88%90%E5%AD%97%E8%8A%82%E6%B5%81%E6%88%96%E8%80%85%E4%BF%9D%E5%AD%98%E5%88%B0%E6%9C%AC%E5%9C%B0/">
										27-从网络上获取图片转换成字节流或者保存到本地
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/28-%E7%9F%AD%E4%BF%A1%E5%8F%91%E9%80%81%E4%B9%8B%E4%BA%92%E8%AF%91%E6%97%A0%E7%BA%BF/">
										28-短信发送之互译无线
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/29-%E9%9D%9E%E7%A9%BA%E5%88%A4%E6%96%AD/">
										29-非空判断
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/30-%E5%88%86%E9%A1%B5%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										30-分页工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/31-%E8%B7%A8%E5%9F%9F%E8%AF%B7%E6%B1%82%E7%9A%84%E5%87%A0%E7%A7%8D%E6%96%B9%E5%BC%8F/">
										31-跨域请求的几种方式
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/32-%E5%89%8D%E7%AB%AF%E9%9C%80%E8%A6%81%E7%9A%84%E6%95%B0%E6%8D%AE%E8%BF%94%E5%9B%9E%E6%A0%BC%E5%BC%8F/">
										32-前端需要的数据返回格式
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/33-%E7%9B%90%E5%80%BC%E7%94%9F%E6%88%90/">
										33-盐值生成
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/34-%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/">
										34-正则表达式
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/02.%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E7%B1%BB/35-%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%B7%A5%E5%85%B7%E7%B1%BB/">
										35-正则表达式工具类
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										03.springboot
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/03.springboot/01-SpringBoot%E7%BA%BF%E7%A8%8B%E6%B1%A0/">
										01-SpringBoot线程池
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
							<ul>
								<li class="directory">
									<a href="#" class="directory">
										<i class="fa fa-plus-square-o"></i>
										04.Linux
									</a>
									
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/01/04.Linux/01-Centos7%E5%BC%80%E6%94%BE%E5%8F%8A%E6%9F%A5%E7%9C%8B%E7%AB%AF%E5%8F%A3/">
										01-Centos7开放及查看端口
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/02-centos7%E5%AE%89%E8%A3%85seata/">
										02-centos7安装seata
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/03-centOS7%E5%AE%89%E8%A3%85Sentinel/">
										03-centOS7安装Sentinel
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/04-%E6%9F%A5%E7%9C%8Blinux%E5%86%85%E6%A0%B8%E7%89%88%E6%9C%AC/">
										04-查看linux内核版本
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/05-centos%E6%9B%B4%E6%94%B9yum%E6%BA%90/">
										05-centos更改yum源
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/06-Linux%E4%B8%8Bwhich%E3%80%81whereis%E3%80%81locate%E3%80%81find%E5%91%BD%E4%BB%A4%E7%9A%84%E5%8C%BA%E5%88%AB/">
										06-Linux下which、whereis、locate、find命令的区别
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/07-centos7%E5%AE%89%E8%A3%85%E4%BB%A3%E7%A0%81%E9%9B%A8cmatrix/">
										07-centos7安装代码雨cmatrix
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/08-gitblit/">
										08-gitblit
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/09-showdoc/">
										09-showdoc
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/10-CentOS7%E6%9F%A5%E7%9C%8B%E5%92%8C%E6%8E%A7%E5%88%B6%E8%BF%9B%E7%A8%8B/">
										10-CentOS7查看和控制进程
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/11-centos%E4%B8%AD%E5%A4%9A%E4%B8%AAtomcat%E9%85%8D%E7%BD%AE/">
										11-centos中多个tomcat配置
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file active">
									<a href="/xinghe/2021/10/02/04.Linux/12-centos%E5%91%BD%E4%BB%A42021%E4%B9%8B%E5%9F%BA%E7%A1%80%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/">
										12-centos命令2021之基础环境配置
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/13-linux%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E7%A6%85%E9%81%93/">
										13-linux一键安装禅道
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/14-centos7%E5%AE%89%E8%A3%85docker/">
										14-centos7安装docker
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/15-tar%E8%A7%A3%E5%8E%8B%E5%88%B0%E6%8C%87%E5%AE%9A%E6%96%87%E4%BB%B6%E5%A4%B9/">
										15-tar解压到指定文件夹
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/16-Linux%E7%B3%BB%E7%BB%9F%E4%B8%8B%E6%9F%A5%E6%89%BE%E5%AE%89%E8%A3%85%E5%8C%85%E6%89%80%E5%9C%A8%E7%9B%AE%E5%BD%95%E7%9A%84%E5%85%AD%E7%A7%8D%E6%96%B9%E6%B3%95/">
										16-Linux系统下查找安装包所在目录的六种方法
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/17-%E6%9F%A5%E7%9C%8BCentOS%E7%89%88%E6%9C%AC%E6%96%B9%E6%B3%95/">
										17-查看CentOS版本方法
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/18-centos6%E8%AE%BE%E7%BD%AE%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8/">
										18-centos6设置开机启动
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/19-%E9%98%BF%E9%87%8C%E4%BA%91centos%E5%AE%89%E8%A3%85%E5%9B%BE%E5%BD%A2%E7%95%8C%E9%9D%A2%EF%BC%8CVNC-VIEWER%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5/">
										19-阿里云centos安装图形界面，VNC-VIEWER远程连接
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/20-centos6%E5%BF%98%E8%AE%B0%E5%AF%86%E7%A0%81/">
										20-centos6忘记密码
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/21-centos6%E5%AE%89%E8%A3%85zookeeper%E5%8D%95%E6%9C%BA%E7%89%88/">
										21-centos6安装zookeeper单机版
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/22-centos%E5%90%84%E4%B8%AA%E7%89%88%E6%9C%AC%E5%9C%B0%E5%9D%80/">
										22-centos各个版本地址
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/23-centos%E4%B8%8Byum%E5%91%BD%E4%BB%A4%E8%AF%A6%E8%A7%A3/">
										23-centos下yum命令详解
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/24-xshell%E4%BF%9D%E6%8C%81%E5%9C%A8%E7%BA%BF/">
										24-xshell保持在线
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/25-%E5%85%B3%E9%97%ADxshell6%E6%8F%90%E7%A4%BA%E9%9F%B3/">
										25-关闭xshell6提示音
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/26-centos6%E6%A8%A1%E6%9D%BF%E5%88%B6%E4%BD%9C%E6%A8%A1%E6%9D%BF/">
										26-centos6模板制作模板
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/27-Linux-yum%E5%8F%AA%E4%B8%8B%E8%BD%BD%E4%B8%8D%E5%AE%89%E8%A3%85/">
										27-Linux-yum只下载不安装
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/28-rmp%E5%8C%85%E6%9F%A5%E6%89%BE%E5%9C%B0%E5%9D%80/">
										28-rmp包查找地址
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/30-centos6%E5%AE%89%E8%A3%85oracle11g/">
										30-centos6安装oracle11g
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/31-maven%E7%A7%81%E6%9C%8D%E4%B9%8Bnexus/">
										31-maven私服之nexus
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/32-centos6%E9%85%8D%E7%BD%AE%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8%E6%96%B9%E5%BC%8F/">
										32-centos6配置开机启动方式
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/02/04.Linux/33-centos6%20%E5%AE%89%E8%A3%85redis%E9%9B%86%E7%BE%A4%E7%89%88/">
										33-centos6 安装redis集群版
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
							<ul>
								<li class="file">
									<a href="/xinghe/2021/10/03/04.Linux/35-CentOS7%E5%AE%89%E8%A3%85ElasticSearch/">
										35-CentOS7安装ElasticSearch
									</a>
								</li>
								<div class="article-toc" style="display: none;"></div>
							</ul>
			
								</li>
								
							</ul>
			
		</div>
	</div>
</div>

	<!-- 引入正文 -->
	<div id="content">
		<h1 id="article-title">

	12-centos命令2021之基础环境配置
</h1>
<div class="article-meta">
	
		<span>
			阅读量:<span id="/xinghe/2021/10/02/04.Linux/12-centos%E5%91%BD%E4%BB%A42021%E4%B9%8B%E5%9F%BA%E7%A1%80%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/" class="leancloud_visitors" data-flag-title=""></span>
		</span>
	
	<span>YH</span>
	<span>2021-10-02 01:36:10</span>
		<div id="article-categories">
    
		<span>Categories：</span>
            
    

    
		<span>Tags：</span>
            
    
		</div>

</div>

<div id="article-content">
	<h3 id="1-更改yum源为阿里云"><a href="#1-更改yum源为阿里云" class="headerlink" title="1.更改yum源为阿里云"></a>1.更改yum源为阿里云</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">备份原来的yum文件</span></span><br><span class="line">mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">下载阿里云yum配置到    /etc/yum.repos.d/</span></span><br><span class="line">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">更新</span></span><br><span class="line">yum makecache</span><br><span class="line">yum -y update</span><br></pre></td></tr></table></figure>
<h3 id="2-yum安装jdk"><a href="#2-yum安装jdk" class="headerlink" title="2.yum安装jdk"></a>2.yum安装jdk</h3><p>安装之前先检查一下系统有没有自带open-jdk</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa |grep java</span><br><span class="line">rpm -qa |grep jdk</span><br><span class="line">rpm -qa |grep gcj</span><br></pre></td></tr></table></figure>
<p>如果没有输入信息表示没有安装。如果安装可以使用rpm -qa | grep java | xargs rpm -e –nodeps 批量卸载所有带有Java的文件<br>安装1.8.0的所有文件</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install java-1.8.0-openjdk* -y</span><br></pre></td></tr></table></figure>
<p>使用命令检查是否安装成功</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">java -version</span><br></pre></td></tr></table></figure>
<p>卸载</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum remove java-1.8.0-openjdk* -y</span><br></pre></td></tr></table></figure>
<h3 id="3-手动安装jdk1-8"><a href="#3-手动安装jdk1-8" class="headerlink" title="3.手动安装jdk1.8"></a>3.手动安装jdk1.8</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/profile</span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="built_in">export</span> PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL</span></span><br><span class="line">export JAVA_HOME=/usr/local/jdk8</span><br><span class="line">export PATH=$JAVA_HOME/bin:$PATH</span><br><span class="line">export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar</span><br><span class="line">source /etc/profile</span><br></pre></td></tr></table></figure>
<p>顺便记录下,tomcat配置</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> vim /etc/profile</span></span><br><span class="line">export TOMCAT_HOME=/usr/local/tomcat7</span><br><span class="line">export CATALINA_HOME=/usr/local/tomcat7</span><br><span class="line"><span class="meta">#</span><span class="bash"> <span class="built_in">source</span> /etc/profile</span></span><br></pre></td></tr></table></figure>
<h3 id="3-yum安装redis单机版"><a href="#3-yum安装redis单机版" class="headerlink" title="3.yum安装redis单机版"></a>3.yum安装redis单机版</h3><p>直接yum 安装的redis 不是最新版本</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install redis</span><br></pre></td></tr></table></figure>
<p>如果要安装最新的redis，需要安装Remi的软件源，官网地址</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http://rpms.famillecollet.com/</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm</span><br></pre></td></tr></table></figure>
<p>然后可以使用下面的命令安装最新版本的redis</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum --enablerepo=remi install redis</span><br></pre></td></tr></table></figure>
<p>安装完毕后，即可使用下面的命令启动redis服务</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl enable redis.service --now</span><br></pre></td></tr></table></figure>
<p>redis安装完毕后，我们来查看下redis安装时创建的相关文件</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa |grep redis</span><br><span class="line">rpm -ql redis</span><br><span class="line"><span class="meta">#</span><span class="bash">查看redis版本</span></span><br><span class="line">redis-cli --version</span><br></pre></td></tr></table></figure>
<p>Redis开启远程登录连接，redis默认只能localhost访问，所以需要开启远程登录</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/redis.conf</span><br><span class="line"><span class="meta">#</span><span class="bash">将<span class="built_in">bind</span> 127.0.0.1 改成了</span></span><br><span class="line">bind 0.0.0.0</span><br><span class="line"><span class="meta">#</span><span class="bash">将protected-mode yes 改为</span></span><br><span class="line">protected-mode no</span><br></pre></td></tr></table></figure>
<h3 id="3-手动安装redis单机版"><a href="#3-手动安装redis单机版" class="headerlink" title="3.手动安装redis单机版"></a>3.手动安装redis单机版</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">yum install -y gcc-c++</span><br><span class="line">tar zxvf redis-3.0.6.tar.gz</span><br><span class="line"><span class="meta">#</span><span class="bash">进入到解压后的目录</span></span><br><span class="line">make</span><br><span class="line"><span class="meta">#</span><span class="bash">进入到src目录下</span></span><br><span class="line">make install PREFIX=/usr/local/redis</span><br><span class="line"><span class="meta">#</span><span class="bash">把解压目录下配置文件拷贝到安装目录bin下</span></span><br><span class="line">cp /usr/local/tmp/redis-3.0.6/redis.conf /usr/local/redis/bin</span><br><span class="line">vim redis.conf</span><br><span class="line"><span class="meta">#</span><span class="bash">把daemonize 由no修改成yes,守护进程启动</span></span><br><span class="line"><span class="meta">#</span><span class="bash">修改<span class="built_in">bind</span> 0.0.0.0 表示所有ip地址都可以访问</span></span><br><span class="line"><span class="meta">#</span><span class="bash">启动redis</span></span><br><span class="line">/redis-server redis.conf</span><br><span class="line"><span class="meta">#</span><span class="bash">关闭redis</span></span><br><span class="line">./redis-cli shutdown</span><br><span class="line"><span class="meta">#</span><span class="bash">redis自带客户端工具</span></span><br><span class="line">./redis-cli</span><br></pre></td></tr></table></figure>
<p>注意:</p>
<blockquote>
<p>var/run/redis.pid exists,process is already running or crashed<br>解决:进入到/var/run下面,删除掉redis开头的pid文件即可</p>
</blockquote>
<p>设置开机自启动:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/init.d/redis</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">!/bin/bash</span></span><br><span class="line"><span class="meta">#</span><span class="bash">chkconfig: 22345 10 90</span></span><br><span class="line"><span class="meta">#</span><span class="bash">description: Start and Stop redis</span></span><br><span class="line"></span><br><span class="line">REDISPORT=6379</span><br><span class="line">EXEC=/usr/local/redis/bin/redis-server</span><br><span class="line">CLIEXEC=/usr/local/redis/bin/redis-cli</span><br><span class="line"></span><br><span class="line">PIDFILE=/var/run/redis.pid</span><br><span class="line">CONF=&quot;/usr/local/redis/bin/redis.conf&quot;</span><br><span class="line"></span><br><span class="line">case &quot;$1&quot; in</span><br><span class="line">    start)</span><br><span class="line">        if [ -f $PIDFILE ];then</span><br><span class="line">            echo &quot;$PIDFILE exists,process is already running or crashed&quot;</span><br><span class="line">        else</span><br><span class="line">            echo &quot;Starting Redis server...&quot;</span><br><span class="line">            $EXEC $CONF</span><br><span class="line">        fi</span><br><span class="line">        ;;</span><br><span class="line">    stop)</span><br><span class="line">        if [ ! -f $PIDFILE ];then</span><br><span class="line">            echo &quot;$PIDFILE does not exist,process is not running&quot;</span><br><span class="line">        else</span><br><span class="line">            PID=$(cat $PIDFILE)</span><br><span class="line">            echo &quot;Stopping...&quot;</span><br><span class="line">            $CLIEXEC -p $REDISPORT shutdown</span><br><span class="line">            while [ -x /proc/$&#123;PID&#125; ]</span><br><span class="line">                do</span><br><span class="line">                    echo &quot;Waiting for Redis to shutdown...&quot;</span><br><span class="line">                    sleep 1</span><br><span class="line">                done</span><br><span class="line">                echo &quot;Redis stopped&quot;</span><br><span class="line">        fi</span><br><span class="line">        ;;</span><br><span class="line">    restart)</span><br><span class="line">        &quot;$0&quot; stop</span><br><span class="line">        sleep 3</span><br><span class="line">        &quot;$0&quot; start</span><br><span class="line">        ;;</span><br><span class="line">    *)</span><br><span class="line">        echo &quot;Please use start or stop or restart as first argument&quot;</span><br><span class="line">        ;;</span><br><span class="line">esac</span><br></pre></td></tr></table></figure>
<p>配置权限和添加自启动</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">chmod +x /etc/init.d/redis</span><br><span class="line">chkconfig --add redis</span><br><span class="line">chkconfig redis on</span><br><span class="line">chkconfig --list   //查看所有注册的脚本文件</span><br></pre></td></tr></table></figure>
<p>新版本的redis需要的配置</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">bind 127.0.0.1 =&gt; bind 0.0.0.0 修改绑定的ip地址</span><br><span class="line">protected-mode yes =&gt; protect-mode no 关闭保护模式</span><br><span class="line">requirepass foobared =&gt; requirepass yourpassword 设置密码，因为redis速度很快，密码尽量设</span><br></pre></td></tr></table></figure>
<h3 id="3-手动安装redis集群版"><a href="#3-手动安装redis集群版" class="headerlink" title="3.手动安装redis集群版"></a>3.手动安装redis集群版</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">ruby脚本</span></span><br><span class="line">yum install ruby -y</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">安装ruby包管理器</span></span><br><span class="line">yum install rubygems -y</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">脚本需要ruby其他包,所以安装这个redis.gem</span></span><br><span class="line">如果安装不上,手动安装命令,gem install -l ./redis-3.0.0.gem</span><br><span class="line">gem install redis-3.0.0.gem</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">在/usr/<span class="built_in">local</span>中新建redis-cluster文件夹</span></span><br><span class="line">mkdir redis-cluster</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">把之前安装好的redis/bin复制到redis-cluster中并起名为redis01</span></span><br><span class="line">cp -r bin ../redis-cluster/redis01</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">删除掉redis01 中dump.rdb数据库文件</span></span><br><span class="line">rm -rf dump.rdb</span><br><span class="line"></span><br><span class="line">vim redis.conf</span><br><span class="line"><span class="meta">#</span><span class="bash">7.1 修改redis01中端口号为7001, 找到port 后面修改为7001</span></span><br><span class="line"><span class="meta">#</span><span class="bash">7.2 去掉cluster-enabled yes前面的注释</span></span><br><span class="line"><span class="meta">#</span><span class="bash">7.3 如果之前设置过密码,注释掉密码.如果没有设置过过略7.3这步骤</span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">复制redis01,复制5份,把redis01文件夹在复制5份,分别起名redis02,redis03,redis04,redis05,redis06</span></span><br><span class="line">cp -r redis01 redis02</span><br><span class="line">cp -r redis01 redis03</span><br><span class="line">cp -r redis01 redis04</span><br><span class="line">cp -r redis01 redis05</span><br><span class="line">cp -r redis01 redis06</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">在redis-cluster下执行</span></span><br><span class="line">vim redis02/redis.conf</span><br><span class="line"><span class="meta">#</span><span class="bash">把其他5个文件夹中redis.conf中port修改成不同的值,分别为7002,7003,7004,7005,7006</span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">去redis解压目录中src下执行此命令,把redis-trib.rb复制到reids-cluster中</span></span><br><span class="line">cp *.rb /usr/local/redis-cluster/</span><br><span class="line"><span class="meta"> </span></span><br><span class="line"><span class="meta"> #</span><span class="bash">创建一个批量启动文件</span></span><br><span class="line"> vim  startall.sh</span><br><span class="line"> cd redis01</span><br><span class="line">./redis-server redis.conf</span><br><span class="line"> cd ..</span><br><span class="line"> cd redis02</span><br><span class="line"> ./redis-server redis.conf</span><br><span class="line"> cd ..</span><br><span class="line"> cd redis03</span><br><span class="line"> ./redis-server redis.conf</span><br><span class="line"> cd ..</span><br><span class="line"> cd redis04</span><br><span class="line"> ./redis-server redis.conf</span><br><span class="line"> cd ..</span><br><span class="line"> cd redis05</span><br><span class="line"> ./redis-server redis.conf</span><br><span class="line"> cd ..</span><br><span class="line"> cd redis06</span><br><span class="line"> ./redis-server redis.conf</span><br><span class="line"> cd ..</span><br><span class="line"><span class="meta">  </span></span><br><span class="line"><span class="meta">#</span><span class="bash">给脚本设置一个可启动权限</span></span><br><span class="line">chmod +x startup.sh</span><br><span class="line"><span class="meta">  </span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 执行脚本,启动所有redis服务</span></span><br><span class="line">./startall.sh</span><br><span class="line"><span class="meta">  </span></span><br><span class="line"><span class="meta">#</span><span class="bash">查看所有服务是否启动成功</span></span><br><span class="line">ps aux|grep redis</span><br><span class="line"><span class="meta">  </span></span><br><span class="line"><span class="meta">#</span><span class="bash">创建集群,在执行时按照提示输入’yes’</span></span><br><span class="line">./redis-trib.rb create --replicas 1 192.168.23.131:7001 192.168.23.131:7002 192.168.23.131:7003 192.168.23.131:7004 192.168.23.131:7005  192.168.23.131:7006</span><br><span class="line"><span class="meta">  </span></span><br><span class="line"><span class="meta">#</span><span class="bash">进入任意节点测试</span></span><br><span class="line">./redis01/redis-cli -h 192.168.23.131 -p 7001 -c</span><br><span class="line"><span class="meta">  </span></span><br><span class="line"><span class="meta">#</span><span class="bash">关闭其中一个redis</span></span><br><span class="line">redis01/redis-cli -p 7001 shutdown</span><br><span class="line">   </span><br><span class="line"><span class="meta">#</span><span class="bash">在redis-cluster中创建文件,并添加下面内容, 在redis-cluster中创建文件,并添加下面内容</span></span><br><span class="line">vim shutdown.sh</span><br><span class="line">    </span><br><span class="line">./redis01/redis-cli -p 7001 shutdown</span><br><span class="line">./redis02/redis-cli -p 7002 shutdown</span><br><span class="line">./redis03/redis-cli -p 7003 shutdown</span><br><span class="line">./redis04/redis-cli -p 7004 shutdown</span><br><span class="line">./redis05/redis-cli -p 7005 shutdown</span><br><span class="line">./redis06/redis-cli -p 7006 shutdown</span><br></pre></td></tr></table></figure>
<h3 id="4-编译dubbo-admin"><a href="#4-编译dubbo-admin" class="headerlink" title="4.编译dubbo-admin"></a>4.编译dubbo-admin</h3><blockquote>
<p>下面这种方式,编译后是个jar包,需要先该zookeeper的地址,再打包</p>
</blockquote>
<p>进入Dubbo官网，点击GIthub<br><a target="_blank" rel="noopener" href="http://dubbo.apache.org/zh-cn/">http://dubbo.apache.org/zh-cn/</a><br>进入到Github页面后，一直往下找到dubbo-admin/dubbo-monitor<br><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811466197-1b74639d-6aaf-4f8d-8300-7a480c7a203e.png#clientId=u9cc54dfa-eef4-4&from=paste&height=334&id=u439ef0a0&margin=%5Bobject%20Object%5D&name=image.png&originHeight=667&originWidth=1113&originalType=binary&ratio=2&size=479574&status=done&style=none&taskId=ueeb668be-fdcc-451d-b8a2-c3c8fba06d0&width=556.5" alt="image.png"><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811466223-5fb94cfd-c769-4114-8fbc-ff4a5af9d44f.png#clientId=u9cc54dfa-eef4-4&from=paste&height=334&id=ub842ee41&margin=%5Bobject%20Object%5D&name=Image.png&originHeight=667&originWidth=1113&originalType=binary&ratio=2&size=486062&status=done&style=none&taskId=u5cef4285-9a9a-4be1-96ee-01dae8be5c5&width=556.5" alt="Image.png"><br>在此页面会看到dubbo-admin-server,但是没有dubbo-admin,这是因为此时的分支是develop,将分支切换为master<br><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811483229-ef2628fa-9670-4fb3-a617-b17d637d3aaa.png#clientId=u9cc54dfa-eef4-4&from=paste&height=319&id=u336caaec&margin=%5Bobject%20Object%5D&name=image.png&originHeight=638&originWidth=1304&originalType=binary&ratio=2&size=427303&status=done&style=none&taskId=u5066bd18-c202-4311-b1ed-48cadeeae59&width=652" alt="image.png"><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811483230-aa06a86a-c588-4350-a395-cbd75ba3f428.png#clientId=u9cc54dfa-eef4-4&from=paste&height=319&id=ud1fdc062&margin=%5Bobject%20Object%5D&name=Image.png&originHeight=638&originWidth=1304&originalType=binary&ratio=2&size=432717&status=done&style=none&taskId=u4385269c-a185-46bd-9eef-5f6a21115cd&width=652" alt="Image.png"><br>此时页面地址为：<br><a target="_blank" rel="noopener" href="https://github.com/apache/dubbo-admin/tree/master">https://github.com/apache/dubbo-admin/tree/master</a><br>在此页面可以看见其官方说明<br>下载后找到dubbo-admin-server/src/main/resources/application.properties<br>将要监控的Zookpeeper注册中心的地址修改，这里是本机。<br><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811506287-b057a443-7c6b-4795-9b83-317b2f97e183.png#clientId=u9cc54dfa-eef4-4&from=paste&height=344&id=u49d1a79a&margin=%5Bobject%20Object%5D&name=image.png&originHeight=687&originWidth=1415&originalType=binary&ratio=2&size=1082169&status=done&style=none&taskId=u704d279e-76ec-4262-85f2-fb4d2d99ca4&width=707.5" alt="image.png"><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811506277-02bf4b83-a373-4b01-b707-79f9787b8b7d.png#clientId=u9cc54dfa-eef4-4&from=paste&height=344&id=u29d8a840&margin=%5Bobject%20Object%5D&name=Image.png&originHeight=687&originWidth=1415&originalType=binary&ratio=2&size=1080764&status=done&style=none&taskId=u40caf613-685f-4f69-9462-1c25bb33977&width=707.5" alt="Image.png"><br>然后回到dubbo-admin目录下，在此处打开命令行窗口，使用maven进行打包</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mvn clean package</span><br></pre></td></tr></table></figure>
<p><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811533467-b21316ce-5a11-43c7-9b50-3e1db62c29ea.png#clientId=u9cc54dfa-eef4-4&from=paste&height=258&id=u62384757&margin=%5Bobject%20Object%5D&name=image.png&originHeight=516&originWidth=1336&originalType=binary&ratio=2&size=399063&status=done&style=none&taskId=u0b80d33c-148a-4f92-9577-0d53b839feb&width=668" alt="image.png"><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811533523-242106f5-89be-403a-a580-7bf37483aebe.png#clientId=u9cc54dfa-eef4-4&from=paste&height=258&id=uc9022539&margin=%5Bobject%20Object%5D&name=Image.png&originHeight=516&originWidth=1336&originalType=binary&ratio=2&size=398119&status=done&style=none&taskId=u6df7d00c-148f-441b-a623-a1bd07e6646&width=668" alt="Image.png"><br>出现Build Success 则就打包成功<br><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811543484-8d687247-15fa-46c9-8386-7370a0abf0d5.png#clientId=u9cc54dfa-eef4-4&from=paste&height=267&id=u44e664b1&margin=%5Bobject%20Object%5D&name=image.png&originHeight=533&originWidth=1122&originalType=binary&ratio=2&size=587395&status=done&style=none&taskId=ua66c2593-bf46-49d0-8b91-4a81ff60fe1&width=561" alt="image.png"><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811543508-ef8263ce-d9ed-4512-b9a7-808388d510da.png#clientId=u9cc54dfa-eef4-4&from=paste&height=267&id=u144b880d&margin=%5Bobject%20Object%5D&name=Image.png&originHeight=533&originWidth=1122&originalType=binary&ratio=2&size=581526&status=done&style=none&taskId=u6072cd10-3a3c-442e-bb65-2eb348f1822&width=561" alt="Image.png"><br>此时在目录下会生成target目录，在target目录下会有一个jar包<br>在运行jar包程序前将上面博客所讲的ZooKeeper的服务端与客户端运行<br>然后在target目录下打开命令行运行jar包</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">java -jar dubbo-admin-0.0.1-SNAPSHOT.jar</span><br><span class="line"><span class="meta">#</span><span class="bash">后台运行命令</span></span><br><span class="line">nohup java -jar dubbo-admin-0.0.1-SNAPSHOT.jar &amp;</span><br></pre></td></tr></table></figure>
<p><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811574257-2b432a6b-bc05-4869-9c00-38f7d05daaac.png#clientId=u9cc54dfa-eef4-4&from=paste&height=325&id=ud93a4341&margin=%5Bobject%20Object%5D&name=image.png&originHeight=650&originWidth=1402&originalType=binary&ratio=2&size=1350154&status=done&style=none&taskId=u06c4fe70-fe63-4250-a761-468acc2fa7f&width=701" alt="image.png"><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623811574279-9c19698d-e256-4f64-8951-14174b481818.png#clientId=u9cc54dfa-eef4-4&from=paste&height=325&id=u76f23e00&margin=%5Bobject%20Object%5D&name=Image.png&originHeight=650&originWidth=1402&originalType=binary&ratio=2&size=1343713&status=done&style=none&taskId=ue0024dba-3b41-434e-9cce-dd2037952f9&width=701" alt="Image.png"><br>此时打开浏览器输入：<br><a target="_blank" rel="noopener" href="http://localhost:7001/">http://localhost:7001/</a><br>默认是7001端口，会提示输入账户密码，默认都是root<br>ps:也可以直接使用当当网的dubbox,里面有dubbo-admin<br><a target="_blank" rel="noopener" href="https://github.com/dangdangdotcom/dubbox">https://github.com/dangdangdotcom/dubbox</a></p>
<h3 id="5-安装zookeeper单机版"><a href="#5-安装zookeeper单机版" class="headerlink" title="5.安装zookeeper单机版"></a>5.安装zookeeper单机版</h3><blockquote>
<p>历史版本<br><a target="_blank" rel="noopener" href="http://archive.apache.org/dist/zookeeper/">http://archive.apache.org/dist/zookeeper/</a></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf zookeeper-3.4.11.tar.gz</span><br><span class="line">cp zoo_sample.cfg zoo.cfg</span><br><span class="line">mkdir /usr/local/zookeeper/data</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>vim zoo.cfg<br><img src="https://www.yuque.com/api/filetransfer/images?url=https://cdn.nlark.com/yuque/0/2021/png/661733/1610613375902-ba8b151a-86ce-4e84-9cee-d992b3f1dd5e.png&sign=2cf00d036a9f6d73d62153a90c547c87ccbb582668159c072eabdd072de5037c#from=url&id=HG7Vr&margin=%5Bobject%20Object%5D&originHeight=410&originWidth=1027&originalType=binary&ratio=2&status=done&style=none"><br>设置开机启动</p>
<blockquote>
<p>注意: 命令不能复制错误</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/init.d/zookeeper</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">!/bin/bash</span></span><br><span class="line"><span class="meta">#</span><span class="bash"></span></span><br><span class="line"><span class="bash"><span class="comment"># zookeeper  ---  this script is used to start and stop zookeeper</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"></span></span><br><span class="line"><span class="bash"><span class="comment"># chkconfig:   - 80 12</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> description:  zookeeper is a centralized service <span class="keyword">for</span> maintaining configuration information,naming,providing distributed synchronization,and providing group services.</span> </span><br><span class="line"><span class="meta">#</span><span class="bash"> processname: zookeeper</span></span><br><span class="line">ZK_PATH=/opt/soft/zookeeper-3.4.11</span><br><span class="line">export JAVA_HOME=/opt/soft/jdk1.8.0_152</span><br><span class="line">case $1 in</span><br><span class="line">         start) sh  $ZK_PATH/bin/zkServer.sh start;;</span><br><span class="line">         stop)  sh  $ZK_PATH/bin/zkServer.sh stop;;</span><br><span class="line">         status) sh  $ZK_PATH/bin/zkServer.sh status;;</span><br><span class="line">         restart) sh $ZK_PATH/bin/zkServer.sh restart;;</span><br><span class="line">         *)  echo &quot;require start|stop|status|restart&quot;  ;;</span><br><span class="line">esac</span><br></pre></td></tr></table></figure>
<p>授权:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod +x /etc/init.d/zookeeper</span><br></pre></td></tr></table></figure>
<p>注册服务</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">chkconfig --add zookeeper</span><br><span class="line">chmod +x /etc/init.d/zookeeper</span><br><span class="line"></span><br><span class="line">chkconfig zookeeper on</span><br></pre></td></tr></table></figure>
<p>命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">service zookeeper start</span><br><span class="line">service zookeeper stop</span><br><span class="line">service zookeeper restart</span><br><span class="line">service zookeeper status</span><br></pre></td></tr></table></figure>
<p>查看zookeeper服务状态</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chkconfig --list zookeeper</span><br></pre></td></tr></table></figure>


<h3 id="6-tomcat解压版配置"><a href="#6-tomcat解压版配置" class="headerlink" title="6.tomcat解压版配置"></a>6.tomcat解压版配置</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">export TOMCAT_HOME=/usr/local/tomcat7</span><br><span class="line">export CATALITA_HOME=/usr/local/tomcat7</span><br></pre></td></tr></table></figure>
<h3 id="7-nacos"><a href="#7-nacos" class="headerlink" title="7.nacos"></a>7.nacos</h3><blockquote>
<p><a target="_blank" rel="noopener" href="https://github.com/alibaba/nacos/releases">https://github.com/alibaba/nacos/releases</a><br>1.解压后,不用配置数据库等之类的,直接启动即可<br>2.网上有些教程写需要配置jdk和maven,个人试过了,配置JDK即可,maven没卵用<br>3.数据库配置文件在conf中,名字是nacos-mysql.sql</p>
</blockquote>
<p>启动命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sh startup.sh -m standalone</span><br></pre></td></tr></table></figure>
<p>访问地址:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">http://127.0.0.1:8848/nacos   用户名/密码：nacos/nacos</span><br><span class="line">http://192.168.21.100:8848/nacos/index.html</span><br></pre></td></tr></table></figure>
<p>配置文件路径</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim nacos/conf/application.properties</span><br></pre></td></tr></table></figure>
<p>shell启动脚本</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">vim startnacos.sh</span><br><span class="line">nohup sh /usr/local/nacos/bin/startup.sh -m standalone &amp;</span><br><span class="line">chmod +x startnacos.sh</span><br></pre></td></tr></table></figure>
<blockquote>
<p>如果需要把配置信息存储到数据库，则需要修改其applications.properties<br>mysql数据库可以新建一个nacos用户,也可以直接使用MySQL用户名密码</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">vim applications.properties</span><br><span class="line"><span class="meta">#</span><span class="bash">解开注释</span></span><br><span class="line">spring.datasource.platform=mysql</span><br><span class="line">db.num=1</span><br><span class="line">db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&amp;connectTimeout=1000&amp;socketTimeout=3000&amp;autoReconnect=true&amp;useUnicode=true&amp;useSSL=false&amp;serverTimezone=UTC</span><br><span class="line">db.user=root</span><br><span class="line">db.password=root</span><br></pre></td></tr></table></figure>
<blockquote>
<p>在mysql数据库中导入nacos-mysql.sq</p>
</blockquote>
<p><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1626690763440-18521794-a4b4-41e4-9e99-ff98276cdb2f.png#clientId=u4a622aad-8b03-4&from=paste&height=56&id=u410fe980&margin=%5Bobject%20Object%5D&name=image.png&originHeight=111&originWidth=1370&originalType=binary&ratio=1&size=21589&status=done&style=none&taskId=uc9d872d4-5be8-439d-9ab7-987f598633b&width=685" alt="image.png"><br>查看日志:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /usr/<span class="built_in">local</span>/nacos/logs/start.out</span><br></pre></td></tr></table></figure>
<h4 id="windows版本"><a href="#windows版本" class="headerlink" title="windows版本"></a>windows版本</h4><p>下载地址:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://github.com/alibaba/nacos/releases</span><br></pre></td></tr></table></figure>
<p>修改application.properties<br><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1632025273273-82b930ae-e5bf-4277-b438-ed43d6552548.png#clientId=u3f24e4ce-a89a-4&from=paste&id=u524f994a&margin=%5Bobject%20Object%5D&name=image.png&originHeight=306&originWidth=1256&originalType=url&ratio=1&size=43305&status=done&style=none&taskId=ub7ece115-b201-4f08-b4d3-cc61f364635" alt="image.png"><br>修改 startup.cmd<br>把MODE改为standalone,单机版<br><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1632025303758-e1351834-2442-498e-bf3c-4cfaa22be886.png#clientId=u3f24e4ce-a89a-4&from=paste&id=u4a2f7fee&margin=%5Bobject%20Object%5D&name=image.png&originHeight=598&originWidth=1045&originalType=url&ratio=1&size=80066&status=done&style=none&taskId=uf9fd6537-28b9-43df-994a-9820d32ec53" alt="image.png"></p>
<h3 id="8-linux之nohup"><a href="#8-linux之nohup" class="headerlink" title="8.linux之nohup"></a>8.linux之nohup</h3><h4 id="1-程序永远在后台运行"><a href="#1-程序永远在后台运行" class="headerlink" title="1.程序永远在后台运行"></a>1.程序永远在后台运行</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nohup 运行的命令 &amp;</span><br></pre></td></tr></table></figure>
<p>出现nohup: ignoring input and appending output to `nohup.out’信息时直接回车,在此目录下有nohup.out文件<br>查看日志命令:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tail -fn 50 nohup.out</span><br></pre></td></tr></table></figure>
<h3 id="9-linux自动不全命令"><a href="#9-linux自动不全命令" class="headerlink" title="9.linux自动不全命令"></a>9.linux自动不全命令</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y bash-completion</span><br></pre></td></tr></table></figure>
<h3 id="10-关闭防火墙"><a href="#10-关闭防火墙" class="headerlink" title="10.关闭防火墙"></a>10.关闭防火墙</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">systemctl stop firewalld</span><br><span class="line"><span class="meta">#</span><span class="bash">禁用防火墙</span></span><br><span class="line">systemctl disable firewalld</span><br></pre></td></tr></table></figure>
<h3 id="11-关闭selinux"><a href="#11-关闭selinux" class="headerlink" title="11.关闭selinux"></a>11.关闭selinux</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/selinux/config</span><br><span class="line"><span class="meta">#</span><span class="bash">将SELINUX=enforcing改为SELINUX=disabled</span></span><br></pre></td></tr></table></figure>
<h3 id="12-查看端口"><a href="#12-查看端口" class="headerlink" title="12.查看端口"></a>12.查看端口</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">netstat -lntup</span><br><span class="line"></span><br><span class="line">-a或--all 显示所有连线中的Socket。</span><br><span class="line">-A&lt;网络类型&gt;或--&lt;网络类型&gt; 列出该网络类型连线中的相关地址。</span><br><span class="line">-c或--continuous 持续列出网络状态。</span><br><span class="line">-C或--cache 显示路由器配置的快取信息。</span><br><span class="line">-e或--extend 显示网络其他相关信息。</span><br><span class="line">-F或--fib 显示路由缓存。</span><br><span class="line">-g或--groups 显示多重广播功能群组组员名单。</span><br><span class="line">-h或--help 在线帮助。</span><br><span class="line">-i或--interfaces 显示网络界面信息表单。</span><br><span class="line">-l或--listening 显示监控中的服务器的Socket。</span><br><span class="line">-M或--masquerade 显示伪装的网络连线。</span><br><span class="line">-n或--numeric 直接使用IP地址，而不通过域名服务器。</span><br><span class="line">-N或--netlink或--symbolic 显示网络硬件外围设备的符号连接名称。</span><br><span class="line">-o或--timers 显示计时器。</span><br><span class="line">-p或--programs 显示正在使用Socket的程序识别码和程序名称。</span><br><span class="line">-r或--route 显示Routing Table。</span><br><span class="line">-s或--statistics 显示网络工作信息统计表。</span><br><span class="line">-t或--tcp 显示TCP传输协议的连线状况。</span><br><span class="line">-u或--udp 显示UDP传输协议的连线状况。</span><br><span class="line">-v或--verbose 显示指令执行过程。</span><br><span class="line">-V或--version 显示版本信息。</span><br><span class="line">-w或--raw 显示RAW传输协议的连线状况。</span><br><span class="line">-x或--unix 此参数的效果和指定&quot;-A unix&quot;参数相同。</span><br><span class="line">--ip或--inet 此参数的效果和指定&quot;-A inet&quot;参数相同</span><br></pre></td></tr></table></figure>
<h3 id="13-配置静态ip"><a href="#13-配置静态ip" class="headerlink" title="13.配置静态ip"></a>13.配置静态ip</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">修改配置文件（ip，掩码，网管，dns根据情况而定）</span></span><br><span class="line">vim /etc/sysconfig/network-scripts/ifcfg-ens33</span><br><span class="line">ONBOOT=no改为yes</span><br><span class="line">BOOTPROTO=static</span><br><span class="line">IPADDR=192.168.168.128</span><br><span class="line">NETMASK=255.255.255.0</span><br><span class="line">GATEWAY=192.168.168.2</span><br><span class="line">DNS1=8.8.8.8</span><br><span class="line"><span class="meta">#</span><span class="bash">重启网络</span></span><br><span class="line">systemctl restart network.service</span><br><span class="line"><span class="meta">#</span><span class="bash">查看ip</span></span><br><span class="line">ip addr</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">重启网络失败 解决方式：禁用NetworkManager</span></span><br><span class="line">systemctl stop NetworkManager</span><br><span class="line">systemctl disable NetworkManager</span><br><span class="line"><span class="meta">#</span><span class="bash">生产环境下 我们一般都是手动配置网络，以静态地址为主不需要系统的网络管理工具，因此，我们就会将它禁用掉</span></span><br></pre></td></tr></table></figure>
<h3 id="14-修改命令提示符颜色和样式"><a href="#14-修改命令提示符颜色和样式" class="headerlink" title="14.修改命令提示符颜色和样式"></a>14.修改命令提示符颜色和样式</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">1 切换到root用户</span></span><br><span class="line"><span class="meta">#</span><span class="bash">2 执行</span> </span><br><span class="line">vim ~/.bashrc</span><br><span class="line"><span class="meta">#</span><span class="bash">添加语句</span> </span><br><span class="line">PS1=&#x27;\[\e[35;40m\][\u@ \W]\$: \[\e[m\]&#x27;</span><br><span class="line"><span class="meta">#</span><span class="bash">或者</span></span><br><span class="line">PS1=&quot;\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m\h\e[m:\w\$ &quot;</span><br><span class="line"><span class="meta">#</span><span class="bash">4 退出VIM 执行</span> </span><br><span class="line">source ~/.bashrc</span><br></pre></td></tr></table></figure>
<h3 id="15-yum安装nginx"><a href="#15-yum安装nginx" class="headerlink" title="15.yum安装nginx"></a>15.yum安装nginx</h3><blockquote>
<p>默认配置在/etc/nginx/conf.d/default.conf和/etc/nginx/nginx.conf<br>yum安装的nginx,配置文件有2个,不太好用,推荐使用手动方式安装nginx</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install yum-utils</span><br></pre></td></tr></table></figure>
<p>添加yum源</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/yum.repos.d/nginx.repo</span><br><span class="line"></span><br><span class="line">[nginx-stable]</span><br><span class="line">name=nginx stable repo</span><br><span class="line">baseurl=http://nginx.org/packages/centos/$releasever/$basearch/</span><br><span class="line">gpgcheck=1</span><br><span class="line">enabled=1</span><br><span class="line">gpgkey=https://nginx.org/keys/nginx_signing.key</span><br><span class="line"></span><br><span class="line">[nginx-mainline]</span><br><span class="line">name=nginx mainline repo</span><br><span class="line">baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/</span><br><span class="line">gpgcheck=1</span><br><span class="line">enabled=0</span><br><span class="line">gpgkey=https://nginx.org/keys/nginx_signing.key</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>也可以用这种方式添加yum源</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">安装</span></span><br><span class="line">yum install nginx -y</span><br><span class="line"></span><br><span class="line">systemctl status nginx</span><br><span class="line">systemctl start nginx</span><br><span class="line">systemctl restart nginx</span><br></pre></td></tr></table></figure>
<p>查找nginx安装位置<br>nginx服务的默认配置文件在 vim /etc/nginx/conf.d/default.conf </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">whereis nginx</span><br><span class="line"></span><br><span class="line">find / -name nginx</span><br></pre></td></tr></table></figure>
<p>测试nginx是否启动</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nginx -t</span><br></pre></td></tr></table></figure>
<p>重载nginx.conf配置文件</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nginx -s relaod</span><br></pre></td></tr></table></figure>
<p>修改Nginx配置文件时，修改vim nginx.conf.default就行</p>
<h3 id="16-手动安装nginx"><a href="#16-手动安装nginx" class="headerlink" title="16.手动安装nginx"></a>16.手动安装nginx</h3><h4 id="1-下载地址"><a href="#1-下载地址" class="headerlink" title="1.下载地址"></a>1.下载地址</h4><blockquote>
<p>注意： 启动容器报错</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http://nginx.org/en/download.html</span><br></pre></td></tr></table></figure>
<p><img src="https://cdn.nlark.com/yuque/0/2021/png/661733/1623850183144-acd16b3c-e842-432b-9ae5-ddb32f52e06b.png#clientId=u8b2c4335-b36b-4&from=paste&height=253&id=u12ab6b96&margin=%5Bobject%20Object%5D&name=image.png&originHeight=505&originWidth=1264&originalType=binary&ratio=2&size=363739&status=done&style=none&taskId=u3262dacb-12f4-4c49-bc63-aa113b13dbd&width=632" alt="image.png"></p>
<h4 id="2-或者直接使用wget"><a href="#2-或者直接使用wget" class="headerlink" title="2.或者直接使用wget"></a>2.或者直接使用wget</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">yum -y install wget -y</span><br><span class="line">wget http://nginx.org/download/nginx-1.18.0.tar.gz</span><br></pre></td></tr></table></figure>
<h4 id="3-安装依赖"><a href="#3-安装依赖" class="headerlink" title="3.安装依赖"></a>3.安装依赖</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">yum install gcc-c++ -y</span><br><span class="line">yum install pcre -y</span><br><span class="line">yum install pcre-devel -y</span><br><span class="line">yum install zlib -y</span><br><span class="line">yum install zlib-devel -y</span><br><span class="line">yum install openssl -y</span><br><span class="line">yum install openssl-devel -y</span><br><span class="line"></span><br><span class="line">tar -zxvf nginx-1.18.0.tar.gz</span><br></pre></td></tr></table></figure>
<p> nginx被解压到了/usr/local/nginx-1.18.0 目录下（不要把压缩包解压到/usr/local/nginx目录下，或者将解压后的目录重命名为nginx，因为nginx会默认安装到/usr/local/nginx目录下），切换到nginx-1.18.0/目录</p>
<h4 id="4-编译"><a href="#4-编译" class="headerlink" title="4.编译"></a>4.编译</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">cd /home/nginx-1.18.0/</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">默认方式</span></span><br><span class="line">./configure</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">使用之前的方式,需要先创建/var/temp/nginx目录</span></span><br><span class="line">mkdir -p /var/temp/nginx</span><br><span class="line"></span><br><span class="line">./configure \</span><br><span class="line">--prefix=/usr/local/nginx \</span><br><span class="line">--pid-path=/var/run/nginx/nginx.pid \</span><br><span class="line">--lock-path=/var/lock/nginx.lock \</span><br><span class="line">--error-log-path=/var/log/nginx/error.log \</span><br><span class="line">--http-log-path=/var/log/nginx/access.log \</span><br><span class="line">--with-http_gzip_static_module \</span><br><span class="line">--http-client-body-temp-path=/var/temp/nginx/client \</span><br><span class="line">--http-proxy-temp-path=/var/temp/nginx/proxy \</span><br><span class="line">--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \</span><br><span class="line">--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \</span><br><span class="line">--http-scgi-temp-path=/var/temp/nginx/scgi</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">编译安装</span></span><br><span class="line">make</span><br><span class="line">make install</span><br></pre></td></tr></table></figure>
<p>默认安装位置是/usr/local/nginx</p>
<h4 id="5-配置nginx开启启动"><a href="#5-配置nginx开启启动" class="headerlink" title="5.配置nginx开启启动"></a>5.配置nginx开启启动</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/init.d/nginx</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">! /bin/bash</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> chkconfig: - 85 15</span></span><br><span class="line">PATH=/usr/local/nginx</span><br><span class="line">DESC=&quot;nginx daemon&quot;</span><br><span class="line">NAME=nginx</span><br><span class="line">DAEMON=$PATH/sbin/$NAME</span><br><span class="line">CONFIGFILE=$PATH/conf/$NAME.conf</span><br><span class="line">PIDFILE=$PATH/logs/$NAME.pid</span><br><span class="line">SCRIPTNAME=/etc/init.d/$NAME</span><br><span class="line">set -e</span><br><span class="line">[ -x &quot;$DAEMON&quot; ] || exit 0</span><br><span class="line">do_start() &#123;</span><br><span class="line"><span class="meta">$</span><span class="bash">DAEMON -c <span class="variable">$CONFIGFILE</span> || <span class="built_in">echo</span> -n <span class="string">&quot;nginx already running&quot;</span></span></span><br><span class="line">&#125;</span><br><span class="line">do_stop() &#123;</span><br><span class="line"><span class="meta">$</span><span class="bash">DAEMON -s stop || <span class="built_in">echo</span> -n <span class="string">&quot;nginx not running&quot;</span></span></span><br><span class="line">&#125;</span><br><span class="line">do_reload() &#123;</span><br><span class="line"><span class="meta">$</span><span class="bash">DAEMON -s reload || <span class="built_in">echo</span> -n <span class="string">&quot;nginx can&#x27;t reload&quot;</span></span></span><br><span class="line">&#125;</span><br><span class="line">case &quot;$1&quot; in</span><br><span class="line">start)</span><br><span class="line">echo -n &quot;Starting $DESC: $NAME&quot;</span><br><span class="line">do_start</span><br><span class="line">echo &quot;.&quot;</span><br><span class="line">;;</span><br><span class="line">stop)</span><br><span class="line">echo -n &quot;Stopping $DESC: $NAME&quot;</span><br><span class="line">do_stop</span><br><span class="line">echo &quot;.&quot;</span><br><span class="line">;;</span><br><span class="line">reload|graceful)</span><br><span class="line">echo -n &quot;Reloading $DESC configuration...&quot;</span><br><span class="line">do_reload</span><br><span class="line">echo &quot;.&quot;</span><br><span class="line">;;</span><br><span class="line">restart)</span><br><span class="line">echo -n &quot;Restarting $DESC: $NAME&quot;</span><br><span class="line">do_stop</span><br><span class="line">do_start</span><br><span class="line">echo &quot;.&quot;</span><br><span class="line">;;</span><br><span class="line">*)</span><br><span class="line">echo &quot;Usage: $SCRIPTNAME &#123;start|stop|reload|restart&#125;&quot; &gt;&amp;2</span><br><span class="line">exit 3</span><br><span class="line">;;</span><br><span class="line">esac</span><br><span class="line">exit 0</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">设置执行权限</span></span><br><span class="line">chmod a+x /etc/init.d/nginx</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">注册成服务</span></span><br><span class="line">chkconfig --add nginx</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">设置开机启动</span></span><br><span class="line">chkconfig nginx on</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">查看nginx服务是否自启动</span></span><br><span class="line">shutdown -h 0 -r</span><br><span class="line">netstat -apn|grep nginx</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">启动停止命令</span></span><br><span class="line"><span class="meta">#</span><span class="bash">启动nginx服务</span></span><br><span class="line">systemctl start nginx.service</span><br><span class="line"><span class="meta">#</span><span class="bash">停止nginx服务</span></span><br><span class="line">systemctl stop nginx.service</span><br><span class="line"><span class="meta">#</span><span class="bash">重启nginx服务</span></span><br><span class="line">systemctl restart nginx.service</span><br><span class="line"><span class="meta">#</span><span class="bash">重新读取nginx配置(这个最常用, 不用停止nginx服务就能使修改的配置生效)</span></span><br><span class="line">systemctl reload nginx.service</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">systemctl enable nginx.service --now</span><br><span class="line"></span><br><span class="line">systemctl start nginx.service    #启动nginx</span><br><span class="line"></span><br><span class="line">systemctl stop nginx.service    #结束nginx</span><br><span class="line"></span><br><span class="line">systemctl restart nginx.service    #重启nginx</span><br></pre></td></tr></table></figure>
<h4 id="6-nginx启动报错"><a href="#6-nginx启动报错" class="headerlink" title="6.nginx启动报错"></a>6.nginx启动报错</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">[root@ system]#: systemctl status nginx.service</span><br><span class="line">● nginx.service - (null)</span><br><span class="line">   Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)</span><br><span class="line">   Active: active (exited) since Sat 2021-07-31 11:47:01 CST; 8s ago</span><br><span class="line">     Docs: man:systemd-sysv-generator(8)</span><br><span class="line">  Process: 8383 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=0/SUCCESS)</span><br><span class="line"> Main PID: 5354 (code=exited, status=1/FAILURE)</span><br><span class="line"></span><br><span class="line">Jul 31 11:47:00 VM-0-8-centos systemd[1]: Starting (null)...</span><br><span class="line">Jul 31 11:47:01 VM-0-8-centos nginx[8383]: Starting nginx daemon: nginx.</span><br><span class="line">Jul 31 11:47:01 VM-0-8-centos nginx[8383]: nginx: [emerg] open() &quot;/var/run/nginx/nginx.pid&quot; failed (2: ...ory)</span><br><span class="line">Jul 31 11:47:01 VM-0-8-centos systemd[1]: Started (null).</span><br><span class="line">Hint: Some lines were ellipsized, use -l to show in full.</span><br></pre></td></tr></table></figure>
<p>解决: 配置pid的位置</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">vim /usr/local/nginx/conf/</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">创建logs目录</span></span><br><span class="line">mkdir /usr/local/nginx/logs</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">打开注释</span></span><br><span class="line">pid    /usr/local/nginx/logs/nginx.pid;</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">重启服务</span></span><br><span class="line">systemctl reload nginx.service</span><br></pre></td></tr></table></figure>
<h4 id="5-彻底卸载"><a href="#5-彻底卸载" class="headerlink" title="5.彻底卸载"></a>5.彻底卸载</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">chkconfig nginx off</span><br><span class="line"></span><br><span class="line">rm -rf /etc/init.d/nginx</span><br><span class="line"></span><br><span class="line">find / -name nginx</span><br><span class="line"></span><br><span class="line">rm -rf  找打的文件</span><br></pre></td></tr></table></figure>
<h3 id="16-配置nginx-vsftpd"><a href="#16-配置nginx-vsftpd" class="headerlink" title="16.配置nginx+vsftpd"></a>16.配置nginx+vsftpd</h3><h4 id="1-修改nginx配置"><a href="#1-修改nginx配置" class="headerlink" title="1.修改nginx配置"></a>1.修改nginx配置</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/nginx/nginx.conf</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">#改为如下</span></span><br><span class="line">user ftpuser;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/nginx/conf.d/default.conf</span><br><span class="line"></span><br><span class="line"><span class="comment">#修改为</span></span><br><span class="line">location / &#123;</span><br><span class="line">        root   /home/ftpuser;</span><br><span class="line">        index  index.html index.htm;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="2-yum安装vsftpd"><a href="#2-yum安装vsftpd" class="headerlink" title="2.yum安装vsftpd"></a>2.yum安装vsftpd</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y install vsftpd</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">useradd ftpuser</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">passwd ftpuser</span><br></pre></td></tr></table></figure>
<h5 id="centos6修改selinux"><a href="#centos6修改selinux" class="headerlink" title="centos6修改selinux"></a>centos6修改selinux</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">getsebool -a | grep ftp</span><br></pre></td></tr></table></figure>
<p>开启外网的访问</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">setsebool -P allow_ftpd_full_access on</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">setsebool -P ftp_home_dir on</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/selinux/config</span><br></pre></td></tr></table></figure>
<p>关闭selinux</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/selinux/config</span><br><span class="line"></span><br><span class="line">SELINUX=<span class="built_in">disable</span></span><br></pre></td></tr></table></figure>
<p>​</p>
<h5 id="centos7修改selinux"><a href="#centos7修改selinux" class="headerlink" title="centos7修改selinux"></a>centos7修改selinux</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">setsebool -P tftp_home_dir on</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">setsebool -P allow_ftpd_full_access on</span><br></pre></td></tr></table></figure>


<p>修改ftphome权限</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chown -R ftpuser.ftpuser /home/ftpuser</span><br></pre></td></tr></table></figure>
<p>配置vsftpd</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/vsftpd/vsftpd.conf</span><br><span class="line"></span><br><span class="line"><span class="comment">#匿名</span></span><br><span class="line"><span class="comment">#anonymous_enable=YES</span></span><br><span class="line">anonymous_enable=NO</span><br><span class="line"></span><br><span class="line">pasv_min_port=30000</span><br><span class="line">pasv_max_port=30999</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">systemctl <span class="built_in">enable</span> vsftpd.service --now</span><br><span class="line"></span><br><span class="line">systemctl start vsftpd.service</span><br><span class="line"></span><br><span class="line">systemctl restart vsftpd.service</span><br><span class="line"></span><br><span class="line">systemctl status vsftpd.service</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>​</p>
<p>​</p>
<h3 id="17-云服务器漏洞修复"><a href="#17-云服务器漏洞修复" class="headerlink" title="17.云服务器漏洞修复"></a>17.云服务器漏洞修复</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">查看可升级系统软件</span></span><br><span class="line">yum check-update</span><br><span class="line"><span class="meta">#</span><span class="bash">更新所有可升级的系统软件</span></span><br><span class="line">yum upgrade</span><br><span class="line"><span class="meta">#</span><span class="bash">也可以使用</span></span><br><span class="line">yum update xxxx (xxxx为你要升级的系统软件)</span><br></pre></td></tr></table></figure>
<h3 id="18-安装activemq"><a href="#18-安装activemq" class="headerlink" title="18.安装activemq"></a>18.安装activemq</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">wget http://archive.apache.org/dist/activemq/5.14.5/apache-activemq-5.14.5-bin.tar.gz</span><br><span class="line"></span><br><span class="line">tar -xzvf apache-activemq-5.14.1-bin.tar.gz</span><br><span class="line"></span><br><span class="line">vim /etc/init.d/activemq</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">!/bin/sh</span></span><br><span class="line"><span class="meta">#</span><span class="bash"></span></span><br><span class="line"><span class="bash"><span class="comment"># /etc/init.d/activemq</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> chkconfig: 345 63 37</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> description: activemq servlet container.</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> processname: activemq 5.14.1</span></span><br><span class="line"><span class="meta"> </span></span><br><span class="line"><span class="meta">#</span><span class="bash"> Source <span class="keyword">function</span> library.</span></span><br><span class="line"><span class="meta">#</span><span class="bash">. /etc/init.d/<span class="built_in">functions</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> <span class="built_in">source</span> networking configuration.</span></span><br><span class="line"><span class="meta">#</span><span class="bash">. /etc/sysconfig/network</span></span><br><span class="line"> </span><br><span class="line">export JAVA_HOME=/usr/local/jdk8</span><br><span class="line">export CATALINA_HOME=/usr/local/activemq</span><br><span class="line"> </span><br><span class="line">case $1 in</span><br><span class="line">    start)</span><br><span class="line">        sh $CATALINA_HOME/bin/activemq start</span><br><span class="line">    ;;</span><br><span class="line">    stop)</span><br><span class="line">        sh $CATALINA_HOME/bin/activemq stop</span><br><span class="line">    ;;</span><br><span class="line">    restart)</span><br><span class="line">        sh $CATALINA_HOME/bin/activemq stop</span><br><span class="line">        sleep 1</span><br><span class="line">        sh $CATALINA_HOME/bin/activemq start</span><br><span class="line">    ;;</span><br><span class="line"> </span><br><span class="line">esac</span><br><span class="line">exit 0</span><br><span class="line"></span><br><span class="line">chmod 777 activemq</span><br><span class="line"></span><br><span class="line">chkconfig activemq on</span><br><span class="line">service activemq start</span><br></pre></td></tr></table></figure>
<p>访问地址：<a target="_blank" rel="noopener" href="http://ip地址:8161/%E3%80%82">http://IP地址:8161/。</a></p>
<p> 默认用户名密码为：admin/admin</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">设置开机启动和关闭</span></span><br><span class="line"></span><br><span class="line">chmod  +x /etc/init.d/activemq</span><br><span class="line"><span class="meta">#</span><span class="bash">chkconfig activemq on</span></span><br><span class="line"><span class="meta">#</span><span class="bash">chkconfig activemq off</span></span><br><span class="line"><span class="meta">#</span><span class="bash">使用下面的命令</span></span><br><span class="line">chkconfig  --add activemq</span><br><span class="line">chkconfig --list</span><br><span class="line"></span><br><span class="line">service activemq start</span><br><span class="line"></span><br><span class="line">service activemq stop</span><br></pre></td></tr></table></figure>
<h3 id="19-关闭图形化界面"><a href="#19-关闭图形化界面" class="headerlink" title="19.关闭图形化界面"></a>19.关闭图形化界面</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">centos7</span></span><br><span class="line">systemctl set-default multi-user.target</span><br><span class="line">systemctl set-default graphical.target</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">cetnos5,6</span></span><br><span class="line">vim /etc/inittab</span><br><span class="line"><span class="meta">#</span><span class="bash">id:5:initdefault 改为id:3:initdefault</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="20-centos7防火墙"><a href="#20-centos7防火墙" class="headerlink" title="20.centos7防火墙"></a>20.centos7防火墙</h3><h4 id="1-放行端口"><a href="#1-放行端口" class="headerlink" title="1.放行端口"></a>1.放行端口</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --zone=public --add-port=5672/tcp --permanent   # 开放5672端口</span><br><span class="line"></span><br><span class="line">firewall-cmd --zone=public --remove-port=5672/tcp --permanent  #关闭5672端口</span><br><span class="line"></span><br><span class="line">firewall-cmd --reload   # 配置立即生效</span><br></pre></td></tr></table></figure>
<h4 id="2-查看防火墙开放的所有端口"><a href="#2-查看防火墙开放的所有端口" class="headerlink" title="2.查看防火墙开放的所有端口"></a>2.查看防火墙开放的所有端口</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --zone=public --list-ports</span><br></pre></td></tr></table></figure>
<h4 id="3-关闭防火墙"><a href="#3-关闭防火墙" class="headerlink" title="3.关闭防火墙"></a>3.关闭防火墙</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">systemctl stop firewalld.service</span><br><span class="line"><span class="meta">#</span><span class="bash">禁用防火墙</span></span><br><span class="line">systemctl disable firewalld.service</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="4-查看防火墙状态"><a href="#4-查看防火墙状态" class="headerlink" title="4.查看防火墙状态"></a>4.查看防火墙状态</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --state</span><br></pre></td></tr></table></figure>
<h4 id="5-查看所有监听端口"><a href="#5-查看所有监听端口" class="headerlink" title="5.查看所有监听端口"></a>5.查看所有监听端口</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">netstat -lnpt</span><br><span class="line"><span class="meta">#</span><span class="bash">假如没有net命令,需要安装</span></span><br><span class="line">yum install -y net-tools</span><br></pre></td></tr></table></figure>
<h4 id="6-查看那个端口被占用"><a href="#6-查看那个端口被占用" class="headerlink" title="6.查看那个端口被占用"></a>6.查看那个端口被占用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -lnpt |grep 5672</span><br></pre></td></tr></table></figure>
<h4 id="7-查看进程详细信息"><a href="#7-查看进程详细信息" class="headerlink" title="7.查看进程详细信息"></a>7.查看进程详细信息</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ps 6832</span><br></pre></td></tr></table></figure>
<h4 id="8-终止进程"><a href="#8-终止进程" class="headerlink" title="8.终止进程"></a>8.终止进程</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kill -9 6832</span><br></pre></td></tr></table></figure>
<h3 id="21-git安装"><a href="#21-git安装" class="headerlink" title="21. git安装"></a>21. git安装</h3><h4 id="1-下载"><a href="#1-下载" class="headerlink" title="1.下载"></a>1.下载</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget https:<span class="comment">//github.com/git/git/archive/v2.14.1.zip</span></span><br></pre></td></tr></table></figure>
<h4 id="2-yum依赖"><a href="#2-yum依赖" class="headerlink" title="2.yum依赖"></a>2.yum依赖</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker</span><br></pre></td></tr></table></figure>
<h4 id="3-解压"><a href="#3-解压" class="headerlink" title="3. 解压"></a>3. 解压</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">unzip v2.14.1.zip</span><br></pre></td></tr></table></figure>
<h4 id="4-将git安装到-usr-local-git上"><a href="#4-将git安装到-usr-local-git上" class="headerlink" title="4.将git安装到/usr/local/git上"></a>4.将git安装到/usr/local/git上</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#先进入git-2.14.1文件夹, 编译,安装</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span> git-2.14.1</span><br><span class="line"></span><br><span class="line">make prefix=/usr/<span class="built_in">local</span> all</span><br><span class="line"></span><br><span class="line">make prefix=/usr/<span class="built_in">local</span> install</span><br></pre></td></tr></table></figure>
<h4 id="5-验证"><a href="#5-验证" class="headerlink" title="5.验证"></a>5.验证</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git --version</span><br></pre></td></tr></table></figure>
<h3 id="22-maven安装"><a href="#22-maven安装" class="headerlink" title="22.maven安装"></a>22.maven安装</h3><h4 id="1-下载-1"><a href="#1-下载-1" class="headerlink" title="1.下载"></a>1.下载</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz</span><br></pre></td></tr></table></figure>
<blockquote>
<p>也可以去maven官网下载<br><a target="_blank" rel="noopener" href="http://maven.apache.org/download.cgi">http://maven.apache.org/download.cgi</a></p>
</blockquote>
<h4 id="2-解压"><a href="#2-解压" class="headerlink" title="2.解压"></a>2.解压</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">tar -xf apache-maven-3.6.3-bin.tar.gz -C /usr/<span class="built_in">local</span>/</span><br><span class="line"></span><br><span class="line">mv /usr/<span class="built_in">local</span>/apache-maven-3.6.3/ maven3.6</span><br></pre></td></tr></table></figure>
<h4 id="3-添加环境"><a href="#3-添加环境" class="headerlink" title="3.添加环境"></a>3.添加环境</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:/usr/<span class="built_in">local</span>/maven3.6/bin</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure>
<h4 id="4-验证"><a href="#4-验证" class="headerlink" title="4.验证"></a>4.验证</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">which</span> mvn</span><br></pre></td></tr></table></figure>
<h3 id="23-gitblit"><a href="#23-gitblit" class="headerlink" title="23.gitblit"></a>23.gitblit</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://github.com/gitblit/gitblit</span><br></pre></td></tr></table></figure>

</div>


    <div class="post-guide">
        <div class="item left">
            
              <a href="/xinghe/2021/10/02/04.Linux/13-linux%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E7%A6%85%E9%81%93/">
                  <i class="fa fa-angle-left" aria-hidden="true"></i>
                  13-linux一键安装禅道
              </a>
            
        </div>
        <div class="item right">
            
              <a href="/xinghe/2021/10/02/04.Linux/15-tar%E8%A7%A3%E5%8E%8B%E5%88%B0%E6%8C%87%E5%AE%9A%E6%96%87%E4%BB%B6%E5%A4%B9/">
                15-tar解压到指定文件夹
                <i class="fa fa-angle-right" aria-hidden="true"></i>
              </a>
            
        </div>
    </div>



	<div id="vcomments"></div>


<script>
	
		// 评论
		new Valine({
			av: AV,
			el: '#vcomments',
			notify: false,
			verify: false,
			path: window.location.pathname,
			appId: 'g5woR5QAkE0rKofVTPiCqSuh-gzGzoHsz',
			appKey: 'Qbwz6GLnQv6JgX9bgtP1bdPC',
			placeholder: '请输入评论',
			avatar: 'retro',
			recordIP: false
		})
	
	
    // 显示次数
		function showTime(Counter) {
			var query = new AV.Query("Counter");
			if($(".leancloud_visitors").length > 0){
				var url = $(".leancloud_visitors").attr('id').trim();
				// where field
				query.equalTo("words", url);
				// count
				query.count().then(function (number) {
					// There are number instances of MyClass where words equals url.
					$(document.getElementById(url)).text(number?  number : '--');
				}, function (error) {
					// error is an instance of AVError.
				});
			}
		}
		// 追加pv
		function addCount(Counter) {
			var url = $(".leancloud_visitors").length > 0 ? $(".leancloud_visitors").attr('id').trim() : 'wujun234.github.io';
			var Counter = AV.Object.extend("Counter");
			var query = new Counter;
			query.save({
				words: url
			}).then(function (object) {
			})
		}
		$(function () {
			var Counter = AV.Object.extend("Counter");
			addCount(Counter);
			showTime(Counter);
		});
	
</script>
	</div>
	<div id="footer">
	<p>
	©2015-<span id="footerYear"></span> 
	<a href="/">YH</a> 
	
	
		|
		<span id="busuanzi_container_site_pv">
			本站总访问量
			<span id="busuanzi_value_site_pv"></span>次
		</span>
		|
		<span id="busuanzi_container_site_uv"> 
			有
			<span id="busuanzi_value_site_uv"></span>看过我的博客啦
		</span>
	
	<br>
	<span id="span"></span>
	</p>
</div>
<script type="text/javascript"> 
	document.getElementById('footerYear').innerHTML = new Date().getFullYear() + '';
</script>
<script type="text/javascript">
    function runtime(){
        // 初始时间，日/月/年 时:分:秒
        X = new Date("11/18/2015 0:00:00");
        Y = new Date();
        T = (Y.getTime()-X.getTime());
        M = 24*60*60*1000;
        a = T/M;
        A = Math.floor(a);
        b = (a-A)*24;
        B = Math.floor(b);
        c = (b-B)*60;
        C = Math.floor((b-B)*60);
        D = Math.floor((c-C)*60);
        //信息写入到DIV中
        span.innerHTML = "本站勉强运行: "+A+"天"+B+"小时"+C+"分"+D+"秒"
    }
    setInterval(runtime, 1000);
</script>
	<button id="totop-toggle" class="toggle"><i class="fa fa-angle-double-up" aria-hidden="true"></i></button>
</body>
</html>